package code.google.jcontainer.test.intercept;

import code.google.jcontainer.support.intercept.Intercept;
import code.google.jcontainer.support.intercept.InterceptContext;
import code.google.jcontainer.support.intercept.Interceptable;
import code.google.jcontainer.test.simple.SimpleBean;

/**
 * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
 * @create 2009-12-24 21:02:37
 */
@SimpleBean(name = "InterceptableTestBean")
public class InterceptableTestBean implements Interceptable {

    public void beforeMethod(InterceptContext interceptContext) throws Exception {
        System.out.println("beforeMethod: " + interceptContext.getMethod().getName());
        interceptContext.setParameters(new Object[]{"World"});
    }

    public void afterMethod(InterceptContext interceptContext) throws Exception {
        System.out.println("afterMethod: " + interceptContext.getMethod().getName());
        interceptContext.setResult("Java");
    }

    @Intercept
    public String echo(String str){
        return str;
    }

    public static void main(String[] args) {

    }
}
